package cn.com.lsy.product.lepao.request.base;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Min;

@ApiModel
public class PageSearchParam {

    @ApiModelProperty(value = "当前页数", required = true)
    @Min(message = "当前页数必须大于0", value = 1)
    private Integer page = 1;

    @ApiModelProperty(value = "每页条数", required = true)
    @Min(message = "每页条数必须大于0", value = 1)
    private Integer pageSize = 10;

    @ApiModelProperty(value = "查询条件", required = false)
    private String searchCondition;

    public int  getStart(){
        if(page==null||page<0){
            page = 1 ;
        }
        return (page-1)*pageSize;
    }


    public Integer getPage() {
        return page;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public String getSearchCondition() {
        return searchCondition;
    }

    public void setSearchCondition(String searchCondition) {
        this.searchCondition = searchCondition;
    }

}
